<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

    <title> - 登录</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link href="css/bootstrap.min.css"  th:href="@{/css/bootstrap.min.css}" rel="stylesheet">
    <link href="css/font-awesome.css?v=4.4.0"  th:href="@{/css/font-awesome.css?v=4.4.0}" rel="stylesheet">
    <link href="css/animate.css" th:href="@{/css/animate.css}" rel="stylesheet">
    <link href="css/style.css" th:href="@{/css/style.css}" rel="stylesheet">
    <link href="css/login.css" th:href="@{/css/login.css}" rel="stylesheet">
    <script src="../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}" ></script>
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>
        if (window.top !== window.self) {
            window.top.location = window.location;
        }
    </script>

</head>

<body class="signin">
<div class="signinpanel">
    <div class="row">
        <div class="col-sm-12">
            <form method="post" >
                <h4 class="no-margins">登录：</h4>
                <h3 class="m-t-md" >自动气象站数据实时信息发布系统</h3>
                <input type="text" class="form-control uname" id="name" placeholder="用户名" />
                <input type="password" class="form-control pword m-b" id="password" placeholder="密码" />
                <!--                    <a href="">忘记密码了？</a>-->
                <input id="submit" class="btn btn-success btn-block" type="button" th:value="登录">
                <!--                    <button id="submit" class="btn btn-success btn-block"  >登录</button>-->
            </form>
            <div class="col-sm-6"></div>
            <button class="btn btn-info " id="toFInd" type="button"><i class="fa fa-cloud"></i> 查询天气数据</button>
        </div>
    </div>
    <div class="signup-footer">
        <div class="pull-left">
            &copy; hAdmin
        </div>
    </div>
</div>
</body>
<!--<script src="js/plugins/metisMenu/jquery.metisMenu.js" th:src="@{/js/plugins/metisMenu/jquery.metisMenu.js}" ></script>-->
<!--<script src="js/plugins/slimscroll/jquery.slimscroll.min.js" th:src="@{/js/plugins/slimscroll/jquery.slimscroll.min.js}" ></script>-->
<script src="js/plugins/layer/layer.min.js" th:src="@{/js/plugins/layer/layer.min.js}"></script>
<!--<script src="js/plugins/pace/pace.min.js" th:src="@{/js/plugins/pace/pace.min.js}" ></script>-->
<script>
    $(document).ready(function() {

        $("#submit").click(function(){
            let name = $("#name").val();
            let password = $("#password").val();

            if (name == null || name == "" || password == null || password == ""){
                parent.layer.msg('用户名和密码不可为空！！！');
                return;
            }

            $.ajax({
                url:"/loginVerification",
                type:"post",
                data:{
                    name:name,
                    password:password
                },
                success:function (result) {
                    let code = result.code;
                    if (code == 200){
                        window.location.href="/login";
                    }else {
                        let msg = result.msg;
                        parent.layer.msg(msg)
                    }
                }
            })

        });

        // 去查询页面
        $("#toFInd").click(function(){
            window.location.href="/meteorologicalData/toFind";
        })

    });
</script>

</html>
